import requests
import re
import time


url = "https://www.toutiao.com/c/user/5743965416/#mid=5743774938"
header = {
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
    'accept-encoding': 'gzip, deflate, br',
    'accept-language': 'zh-CN,zh;q=0.9',
    'cache-control': 'max-age=0',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
}
req = requests.get(url=url,headers=header).text
# print(req)
pattern = "guanzhu:'(.*?)',\n      fensi:'(\d+)"
# pattern1 = r'https://www.toutiao.com/group/\d+/'
articleInfo=re.compile(pattern).findall(req)
print(articleInfo)
# for i in articleInfo:
#     # print(i)
#     ou = "https://www.toutiao.com/i{0}/".format(i)
#     req1 = requests.get(url=ou,headers=header).status_code
#     print(req1)